/*
 * @Author: 李天惊 uf_lee@163.com
 * @Date: 2022-08-15 16:45:25
 * @LastEditors: 李天惊 uf_lee@163.com
 * @LastEditTime: 2023-08-03 15:41:09
 * @FilePath: \zhmc\pc\sys\src\api\uc\user\index.ts
 * Copyright (c) 2022 by 李天惊 uf_lee@163.com, All Rights Reserved.
 */
import { useAxios } from '@/hooks/web/useAxios'
import type { TableData } from './types'
const request = useAxios()

import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 用户列表
export const ucUserListAdminApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucUserListAdmin',
      data: data
    }
  })
}

// 用户修改
export const ucUserEditAdminApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucUserEditAdmin',
      data: data
    }
  })
}

// 用户新增
export const ucUserAddAdminApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucUserAddAdmin',
      data: data
    }
  })
}

// 用户删除
export const ucUserDelAdminApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucUserDelAdmin',
      data: data
    }
  })
}

// 用户批量删除
export const ucUserBatchDelAdminApi = (data: { ids: object }) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucUserBatchDelAdmin',
      data: data
    }
  })
}

// 用户修改密码
export const ucUserEditPasswordAdminApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucUserEditPasswordAdmin',
      data: data
    }
  })
}
